package com.whfc.ms.api.quality.service.impl;

import com.whfc.common.result.PageData;
import com.whfc.ms.api.quality.service.MsQualityFineService;
import com.whfc.quality.dto.QualityFineDTO;
import com.whfc.quality.dto.QualityFineNumDTO;
import com.whfc.quality.param.QualityFineAddParam;
import com.whfc.quality.param.QualityFineCompleteParam;
import com.whfc.quality.service.QualityFineService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class MsQualityFineServiceImpl implements MsQualityFineService {

    @DubboReference(interfaceClass = QualityFineService.class, version = "1.0.0")
    private QualityFineService qualityFineService;

    @Override
    public PageData<QualityFineDTO> list(Integer deptId, String corpName, String userName, String state, Date startTime, Date endTime, Integer pageNum, Integer pageSize) {
        return qualityFineService.list(deptId, corpName, userName, state, startTime, endTime, pageSize, pageNum);
    }

    @Override
    public QualityFineNumDTO num(Integer deptId, String corpName, String userName, Date startTime, Date endTime) {
        return qualityFineService.num(deptId, corpName, userName, startTime, endTime);
    }

    @Override
    public void add(QualityFineAddParam param) {
        qualityFineService.add(param);
    }

    @Override
    public void del(Integer fineId) {
        qualityFineService.del(fineId);
    }

    @Override
    public void complete(QualityFineCompleteParam param) {
        qualityFineService.complete(param);
    }

    @Override
    public void export(String fineIds, Integer deptId) {
        String[] strIds = fineIds.split(",");
        List<Integer> intIds = Arrays.stream(strIds).map(Integer::valueOf).collect(Collectors.toList());
        qualityFineService.fineExport(intIds, deptId);
    }

    @Override
    public void deleteBatch(List<Integer> idList) {
        qualityFineService.deleteBatch(idList);
    }
}
